﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using GiaoTrinhEPU.Repositories;

namespace GiaoTrinhEPU.Repositories.DataModels
{
   public class ImportModel
    {
        [HiddenInput(DisplayValue = false)]
        public int Id { get; set; }

        [Required(ErrorMessage = "Tên không được để trống")]
        [DataType(DataType.Text)]
        [Remote("IsNameAvaiable", "Author", AdditionalFields = "Id")]
        [Display(Name = "Tên")]
        public String Code { get; set; }

        [Display(Name = "Ngày nhập")]
        public DateTime IDate { get; set; }

        [Display(Name = "Số lượng")]
        public int Quantum { get; set; }

        [Display(Name = "Tên Kho")]
        public int WarehouseId { get; set; }

        [DataType(DataType.MultilineText)]
        [AllowHtml]
        public String Description { get; set; }

        
        public String WarehouseName { get; set; } 

        public ImportModel () : base() { }
        public ImportModel(Import import)
            : base()
        {
            this.Id = (int)import.Id;
            this.Code = import.Code;
            this.IDate = import.IDate;
            this.Quantum = import.Quantum;
            this.WarehouseId = import.WarehouseId;
            this.Description = import.Description;
            
        }
    }
}
